<?php

namespace App\Controller;

use App\Base\BaseController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

/**
 * @Route("/huanqiu")
 */
class LearnController extends BaseController
{

    public $data = [];
    public function initData()
    {
        $this->data["env"] = "dev";
        $this->data["root"] = "/ApiCloud";
        $this->data["rnd"] = "?t=".time();
        $this->data["Client"] = "Shop";
    }

    /**
     * @Route("/index", name="HuanQiuIndex")
     */
    public function HuanQiuIndex()
    {
        $this->initData();
        $this->data["PageName"] = "index";
        $this->data["title"] = "环球十一";
        $this->data["title"] = "index";
        $this->data["curTab"] = 1;

        return $this->render('HuanQiu/index.php.twig',$this->data);
//        echo $this->renderView('HuanQiu/index.php.twig',$this->data);
    }

    /**
     * @Route("/product", name="HuanQiuProduct")
     */
    public function HuanQiuProduct()
    {
        $this->initData();
        $this->data["PageName"] = "product";
        $this->data["title"] = "美国";
        $this->data["title"] = "product";
//        return $this->render('HuanQiu/product.php.twig',$this->data);
        echo $this->renderView('HuanQiu/product.php.twig',$this->data);
    }

    /**
     * @Route("/undo", name="HuanQiuUndo")
     */
    public function HuanQiuUndo()
    {
        $this->initData();
        $this->data["PageName"] = "undo";
        $this->data["title"] = "我的待办";
        return $this->render('HuanQiu/undo.php.twig',$this->data);
    }

    /**
     * @Route("/ex", name="testExcel")
     */
    public function testExcel()
    {
        $orders = [
            [1,2,3,4,5,777]
            ,[1,2,3,4,5,777]
            ,[1,2,3,4,5,777]
            ,[1,2,3,4,5,777]
            ,[1,2,3,4,5,777]
            ,[1,2,3,4,5,777]
        ];

        $title = ["用户ID","返利合计","返利次数","最大返利","最小返利","联系人","手机号","最近登陆","","","","","","","","","","","","","","","","","","","","","","",];
        $this->excelOut($title,$orders,"Money_Hb_".date(YMDHIS));
        exit;
    }
}
